package com.cx.mall.demo.service;

// UserService.java
import com.cx.mall.demo.entity.User;
import com.cx.mall.demo.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 检查手机号是否已注册
     */
    public boolean isPhoneRegistered(String phoneNumber) {
        User user = userMapper.findByPhoneNumber(phoneNumber);
//        System.out.println("查询手机号: " + phoneNumber + "，结果: " + (user != null ? "存在" : "不存在"));
        return user != null;
    }
}